<script charset="utf-8" src="/assets/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="/assets/kindeditor/lang/zh_CN.js"></script>
<script>
    KindEditor.ready(function(K) {

        window.editor = K.create('#meiti_body', {
            width : '900px',
            minWidth : '380px',
            cssData : "body {font-size: 15px;}",
            height:'1000px',
            items : [
                'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
                'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
                'flash', 'media', 'table', 'hr', 'pagebreak',
                'anchor', 'link', 'unlink', '|', 'about'
            ],
            afterCreate : function() {
                this.sync();
            },
            uploadJson : '/admins/news/upload_json',
            fileManagerJson : '../asp/file_manager_json.asp',
            allowFileManager : true,
            afterBlur: function(){
                this.sync();
            }//同步KindEditor的值到textarea文本框
        });
    });
</script>

    <%= form_for @meiti, as: :meiti, url: @meiti.id ? admins_meiti_path : admins_meitis_path,method: @meiti.id ? 'put' : 'post', html: {class: "form-horizontal", role: "form",:multipart => true} do |f| %>
    <table class="edit_table">
      <tr>
        <td>新闻类别:</td>
        <td>
          媒体华理
        </td>
      </tr>
      <tr>
        <td>新闻肩题</td>
        <td><%= f.text_field :uptitle, :class => 'long_input' %></td>
      </tr>
      <tr>
        <td>新闻标题<%= must_label %></td>
        <td><%= f.text_field :title, :class => 'long_input' %></td>
      </tr>
      <tr>
        <td>新闻副题</td>
        <td><%= f.text_field :bottomtitle, :class => 'long_input' %></td>
      </tr>
      <tr>
        <td>关键词</td>
        <td><%= f.text_field :keywords %> </br>
          <div style="color: #4298BA;">(注：多个关键词用“|”分隔。如：关键词1|关键词2)</div></td>
      </tr>
      <tr>
        <td>稿件作者<%= must_label %></td>
        <td><%= f.text_field :writer %></td>
      </tr>
      <tr>
        <td>摄影作者</td>
        <td><%= f.text_field :cameraman_name %><span style="color: #4298BA;">(<%= must_label %>如有照片请填写摄影师名称)</span></td>
      </tr>
      <tr>
        <td>联系电话</td>
        <td><%= f.text_field :phone %></td>
      </tr>
      <tr>
        <td>原文来源</td>
        <td><%= f.text_field :source, :class => 'long_input' %></td>
      </tr>
      <tr>
        <td>原文链接</td>
        <td><%= f.text_field :source_url, :class => 'long_input' %></td>
      </tr>
      <tr>
        <td>发表时间<%= must_label %></td>
        <td><%= f.text_field :commitime,:class => 'datepicker',required:true %></td>
      </tr>
      <tr>
        <td colspan="2">正文<%= must_label %><span style="color: #4298BA;">图片(gif jpg jpeg png bmp,均小写).<br/>视频,音频(swf flv mp3 wav wma wmv mid avi mpg asf rm rmvb mov mp4 mkv vob divx mpeg mpe aif acm asp au)大小不能超过30M</span></td>
      </tr>
      <tr>
        <td colspan="2">
          <div class="col-sm-10">
            <%= f.text_area :body %>
          </div>
        </td>
      </tr>
      <tr>
        <td colspan="2" align="center">
          <%= f.submit'确认',:class => 'btn btn-primary' %>
          <%= link_to '返回',admins_meitis_path,:class => 'btn btn-info' %>
        </td>
      </tr>
    </table>
 <% end %>
    <script type="text/javascript">
        $(document).ready(function(){
            $('.datepicker').datepicker({
                format: 'yyyy-mm-dd'
            });
        });
    </script>
